require "import"
import "android.content.Context"
import "android.os.Vibrator"
import "android.media.ToneGenerator"
import "android.media.AudioManager"

local context = activity or service
local vibrator = context.getSystemService(Context.VIBRATOR_SERVICE)
local toneGenerator = ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100)

if service.click({
    {"#id/draft_send_v2$100"}
}) then
toneGenerator.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 50)
vibrator.vibrate(50)
    return true
end

if service.click({
    {"#id/voice_note_btn$100", "%模拟上滑$100"}
}) then
vibrator.vibrate(50)
toneGenerator.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 50)
return true
end

if service.click({
    {"#id/draft_send_v2$100"}
}) then
toneGenerator.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 50)
vibrator.vibrate(50)
    return true
end

if service.click({
    {"#id/send$100"}
}) then
toneGenerator.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 50)
vibrator.vibrate(50)
    return true
end

if service.click({
    {"#id/fab$100"}
}) then
toneGenerator.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 50)
vibrator.vibrate(50)
    return true
end

if service.click({
    {"#id/button1$100"}
}) then
toneGenerator.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 50)
vibrator.vibrate(50)
    return true
end

if service.click({
    {"#id/next_btn$100"}
}) then
toneGenerator.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 50)
vibrator.vibrate(50)
    return true
end

if service.click({
    {"#id/send_btn$100"}
}) then
toneGenerator.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 50)
vibrator.vibrate(50)
    return true
end
return true